feat(cli): add --read-only flag to disable write operations#41
feat(cli): add --read-only flag to disable write operations#41EItanya merged 2 commits intokagent-dev:mainfrom
Conversation
Add a new `--read-only` CLI flag that disables tools which perform write operations (delete, patch, scale, create, apply, etc.). This enables deploying the MCP server in read-only mode for: - Observability-only use cases (monitoring, troubleshooting) - Environments with read-only service accounts - Compliance requirements separating read/write capabilities Tools are categorized as read-only or write operations: - K8s: 8 read-only, 14 write tools - Helm: 3 read-only, 3 write tools - Istio: 9 read-only, 3 write tools - Cilium: ~25 read-only, ~15 write tools - Argo: 4 read-only, 4 write tools - Prometheus/Kubescape/Utils: all read-only (unchanged) Co-Authored-By: Claude Opus 4.5 Signed-off-by: Matteo Mori <[email protected]>
2d81f3a to
392d29d
Compare
--read-only flag to disable write operationsThere was a problem hiding this comment.
I like the idea of this overall, but I'm not convinced this really solves the problem, maybe we should also remove all write operations from the ServiceAccount which kmcp uses by default?
Actually, there's also an issue for that already #40
The utils provider exposes a `shell` tool that executes arbitrary commands, bypassing read-only restrictions. In read-only mode, this tool is now disabled. Also pass readOnly to all providers (kubescape, prometheus, utils) for consistency with the existing providers. Signed-off-by: Matteo Mori <[email protected]>
|
Hey @EItanya thanks for the review! 😄 This flag is intentionally solving a different part of the problem: it controls which tools are advertised to agents via MCP, so write-capable tools are removed from the tool list entirely and the LLM never sees them. That distinction matters because many “write” operations don’t go through the Kubernetes API at all. A lot of the tools we have here ( like Even within a single category the auth model can be inconsistent. For example, So I see these as two layers of the same story:
While reviewing this I also noticed a gap in my PR: the |
Add a new
--read-onlyCLI flag that prevents the MCP server from advertising write-operation tools to the agent. When enabled, tools that perform mutations (delete, patch, scale, create, apply, etc.) and theshelltool are removed from the tool list entirely -- the LLM never sees them.This enables deploying the MCP server in read-only mode for:
Co-Authored-By: Claude Opus 4.6